<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript对象</title>
</head>

<body>
    <script>
        //对象由花括号分隔。在括号内部，对象的属性以名称和值对的形式 (name : value) 来定义。属性由逗号分隔：
        //空格和折行无关紧要。声明可横跨多行：
        var person = {
            firstname: "John",
            lastname: "Doe",
            id: 5566
        };
        //对象属性有两种寻址方式：
        document.write(person.lastname + "<br />"); //Doe
        document.write(person["lastname"] + "<br />");  //Doe
    </script>
</body>

</html>